{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from datetime import date\n",
    "import time\n",
    "\n",
    "xl = pd.ExcelFile(\"door-events_export_1548749686384.xlsx\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>key</th>\n",
       "      <th>device</th>\n",
       "      <th>doorName</th>\n",
       "      <th>eventDatetime</th>\n",
       "      <th>message</th>\n",
       "      <th>type</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-LXNee1WlhDq0Ng5n5n4</td>\n",
       "      <td>aaaabbbb</td>\n",
       "      <td>Door Timbre+ - Level 3</td>\n",
       "      <td>1548749545728</td>\n",
       "      <td>Battery level : 0%</td>\n",
       "      <td>Battery</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-LXNee1VDnaU_TV6AWZy</td>\n",
       "      <td>aaaabbbb</td>\n",
       "      <td>Door Timbre+ - Level 3</td>\n",
       "      <td>1548749545727</td>\n",
       "      <td>Door is closed</td>\n",
       "      <td>DoorClosed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-LXNdE-rS7EQvuyxG-E2</td>\n",
       "      <td>166fff24ab4f4a52a31a936369d0a1cc</td>\n",
       "      <td>Door Sengkang - Level 4</td>\n",
       "      <td>1548749172886</td>\n",
       "      <td>Door is closed</td>\n",
       "      <td>DoorClosed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-LXNdDsj_YrZ2po64EtR</td>\n",
       "      <td>166fff24ab4f4a52a31a936369d0a1cc</td>\n",
       "      <td>Door Sengkang - Level 4</td>\n",
       "      <td>1548749172366</td>\n",
       "      <td>Door is closed</td>\n",
       "      <td>DoorClosed</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-LXNd8wDCQ8IKXvzfJ-q</td>\n",
       "      <td>166fff24ab4f4a52a31a936369d0a1cc</td>\n",
       "      <td>Door Sengkang - Level 4</td>\n",
       "      <td>1548749152109</td>\n",
       "      <td>Door is open</td>\n",
       "      <td>DoorOpen</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                    key                            device  \\\n",
       "0  -LXNee1WlhDq0Ng5n5n4                          aaaabbbb   \n",
       "1  -LXNee1VDnaU_TV6AWZy                          aaaabbbb   \n",
       "2  -LXNdE-rS7EQvuyxG-E2  166fff24ab4f4a52a31a936369d0a1cc   \n",
       "3  -LXNdDsj_YrZ2po64EtR  166fff24ab4f4a52a31a936369d0a1cc   \n",
       "4  -LXNd8wDCQ8IKXvzfJ-q  166fff24ab4f4a52a31a936369d0a1cc   \n",
       "\n",
       "                  doorName  eventDatetime             message        type  \n",
       "0   Door Timbre+ - Level 3  1548749545728  Battery level : 0%     Battery  \n",
       "1   Door Timbre+ - Level 3  1548749545727      Door is closed  DoorClosed  \n",
       "2  Door Sengkang - Level 4  1548749172886      Door is closed  DoorClosed  \n",
       "3  Door Sengkang - Level 4  1548749172366      Door is closed  DoorClosed  \n",
       "4  Door Sengkang - Level 4  1548749152109        Door is open    DoorOpen  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "xl.sheet_names\n",
    "df = xl.parse(\"data\")\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Mon, 11 Oct 2460 18:04:17 +08'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#1490157520.05 1548749545728\n",
    "time.strftime(\"%a, %d %b %Y %H:%M:%S %Z\", time.localtime(15487495457.28))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "datetime.date(2019, 1, 29)"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "date.today()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'Tue, 29 Jan 2019 08:05:52 GMT'"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.strftime(\"%a, %d %b %Y %H:%M:%S %Z\", time.gmtime(1548749152109/1000.))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
